<?php
/**
 * Created by PhpStorm.
 * Author: 芸签cms www.yunqiancms.com
 * User: sun
 * Date: 2022/6/24
 * Time: 9:05 AM
 */
namespace app\common\facades;


use Illuminate\Support\Facades\Facade;
use app\common\models\Setting as SettingModel;
use app\common\helpers\Cache;

class Setting extends Facade
{
    private static $instance;

    protected static function getFacadeAccessor()
    {
        return 'setting';
    }

    public static function getInstance()
    {
        if (is_null(self::$instance)) {
            self::$instance = new SettingModel();
        }
        return self::$instance;
    }

    /**
     * 设置配置
     * @param $key
     * @param null $value
     * @return mixed
     */
    public static function set($key, $value = null)
    {
        return self::getInstance()->setValue($key, $value);
    }

    /**
     * 获取配置
     * @param $key
     * @param null $default
     * @return mixed
     */
    public static function get($key, $default = null)
    {
        return self::getInstance()->getValue($key, $default);
    }
}